package design.action.command;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zxs
 * @since 2020/05/26
 */
public class Invoker {

    public List<Command> commands = new ArrayList<>();

    public void addCommand(Command command){
        commands.add(command);
    }

    public void removeCommand(Command command){
        commands.remove(command);
    }

    public void invoke(){
        commands.forEach(Command::execute);
    }
}
